//package com.sky.security;
//
//import com.alibaba.fastjson.JSON;
//import com.sky.result.Result;
//import org.springframework.http.MediaType;
//import org.springframework.security.core.AuthenticationException;
//import org.springframework.security.web.AuthenticationEntryPoint;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
//public class MyAuthenticationEntryPoint implements AuthenticationEntryPoint {
//    @Override
//    public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
//        Result<Object> result = new Result<>();
//        result.setCode(0);
//        result.setMsg("非法用户");
//        result.setData(authException.getMessage());
//        String jsonString = JSON.toJSONString(result);
//        response.setContentType("application/json;charset=UTF-8");
//        response.getWriter().write(jsonString);
//
//    }
////}
